<template>
  <div id="ReceiptDetail" v-loading="loading">
    <v-tableTitle
      :btnConfig="btnConfig"
      :tableSelectData="tableSelectData"
      :title="$t('in.receiptDetails1')"
    ></v-tableTitle>
    <v-table
      :hasEdit="false"
      :page="page"
      :pageSize="pageSize"
      :tableConfig="tableConfig"
      :tableData="tableData"
      :total="total"
      @findData="getTableData"
      @getTableData="getTableData"
      @searhData="searhData"
      @selectData="selectData"
      @upData="getTableData"
      ref="table"
    ></v-table>
    <router-view></router-view>
  </div>
</template>

<script type="text/ecmascript-6">
import tableTitle from "commons/TableTitle";
import table from "commons/Table";
import baseMixin from "@/mixins/BaseMixin";
import config from "./Config";

export default {
    name: "receiptDetail",
    mixins: [baseMixin, config],
    data() {
        return {
            loading: false,
            tableData: [],
          page: 1,
            pageSize: 10,
            total: 0,
            tableSelectData: [],
            tableSearhData: {},
        };
    },
    created() {
    },
    methods: {
        //选中的内容
        selectData(data) {
            this.tableSelectData = data;
        },
        async getTableData(page, data) {
            try {
                this.loading = true;
                let res = await this.$api.post(`/receiptdetailList/${page}`, data);
                
                    this.loading = false;
                    this.tableData = res.page.list;
                  this.page = res.page.curPage;
                    this.pageSize = res.page.pageSize;
                    this.total = res.page.total;
                
            } catch (e) {
                this.loading = false;
                this.$message.error(e);
            }
        },
        searhData(data, up) {
            if (!up) {
                this.tableSearhData = data;
            } else {
                this.tableSearhData = data;
                this.getTableData(1, this.tableSearhData);
            }
        },

    },
    mounted() {
        this.$store.commit("setSkip", {});
        this.getTableData(1, {});
    },
    watch: {},
    components: {
        "v-tableTitle": tableTitle,
        "v-table": table,
    }
};
</script>

<style scoped>
#ReceiptDetail {
  width: 100%;
  height: 99%;
  padding-top: 6px;
}
</style>
